package fr.ece.ing4.si.yahoo;

import java.util.Map;
import java.util.concurrent.Callable;

public final class TickerComputation implements Callable<Double> {

	private final Map<String, Integer> stocks;
	private final String theTickerSymbol;

	public TickerComputation(Map<String, Integer> stocks, String theTickerSymbol) {
		this.stocks = stocks;
		this.theTickerSymbol = theTickerSymbol;
	}

	@Override
	public Double call() throws Exception {
	
		return stocks.get(theTickerSymbol).intValue() * 
	            YahooFinance.getPrice(theTickerSymbol);
	}

}
